package designpattern.simplefactory;

public class ShapeFactoryReflection {

    public static Shape getShape(Class<?> clazz){
        Shape shape = null;
        try {
            shape = (Shape) clazz.newInstance();
        }catch (Exception e){
            System.out.println("反射发生错误 "+e.getMessage());
        }
        return shape;
    }
}
